<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主</title>
<import type='css' file="css.main" />
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<import type='js' file="js.main" />
	<style type="text/css">
		body{font-size: 14px;}
		h1.infotitle{display: block; text-align: center; line-height: 36px; clear: both; overflow: hidden; margin-top: 60px; font-weight: normal; font-size: 32px;}
		.awardw{width: 80%; margin: 0px auto;}
		.tableinfo{width: 100%; clear: both; margin-top: 20px;}
		table{border-collapse:collapse; border: solid 1px #ebebeb; border-color: #ebebeb;}
		table th{height: 40px; line-height: 40px; background-color: #00A388; color: #fff; font-weight: normal; font-size: 16px;}
		table tr td{text-align: center; padding: 10px;}
		.awardresult{line-height: 32px; clear: both; margin-top: 20px; font-size: 16px; text-align: center;}
		.awardresult input.key{background-color: #fff; width: 280px; border-radius: 5px; border: solid 1px #ccc; height: 24px; line-height: 24px; text-align: center; font-size: 16px; letter-spacing:1px;}
		.awardresult input.search{background-color: #00A388; color: #fff; border: none; border-radius: 5px; padding: 5px 15px; font-weight: bold; font-size: 16px;}
		a.setstatus{text-align: center; color: #fff; cursor: pointer; background-color: #ff5454; padding: 4px 15px; border-radius:5px;}
		.caozuo a:hover{background-color: #383e4c;}
		select.setaward{height: 25px; line-height: 25px; border-radius: 5px;}
		select.setaward option{line-height: 25px;}
		.page{text-align: center;}
		.page a{color: #333;}
		.page *{display: inline; padding: 0px 3px;}
		.tdselect select{border: none; height: 24px; line-height: 24px; width: 80%;}
	</style>
</head>

<body>
<div class="awardw">
	<h1 class="infotitle">中奖操作</h1>
	<div class="awardresult">
		<form action="noawardsearch" method="post" name="form1" id="form1">
			<input type="text" class="key" name="key" value="{$key}" placeholder="请输入姓名或者手机号码" />
			<input type="submit" class="search" value="搜索" />
			&nbsp;&nbsp;&nbsp;&nbsp;数量：{$count}
		</form>
	</div>
	<div class="tableinfo">
		<table width="100%" border="1" cellspacing="0" cellpadding="0" class="indextable">
			<tr>
				<th width="5%">ID</th>
				<th width="15%">姓名</th>
				<th width="15%">手机号</th>
				<th width="15%">对应码</th>
				<th width="25%">奖品名称</th>
				<th width="15%">操作</th>
			</tr>
			<volist name="result" id="v" empty="没有中奖数据">
			<tr>
				<td>{$v['id']}</td>
				<td>{$v['name']}</td>
				<td>{$v['mobile']}</td>
				<td>{$v['fakecode']}</td>
				<td class="tdselect">
					<select name="awareresult1">
						<option value="0" selected>未中奖</option>
						<volist name="awardlist" id="v1">
							<option value="{$v1['id']}">{$v1['awardname']}</option>
						</volist>
					</select>
				</td>
				<td class="caozuo">-
					<!--<a class="setstatus" v="{$v['id']}">确认指定奖品</a>-->
				</td>
			</tr>
			</volist>
		</table>
		<div class="page">{$page}</div>
	</div>
</div>

<script type="text/javascript">
	$(function(){
		$(".tableinfo table tr").each(function(index,element){
			var t = $(this);
			t.find("a.setstatus").click(function(){
				var id = $(this).attr('v');
				var awardid = t.find("select").val();
				if(awardid!=0){
					queryctrool(id,awardid);
				}else{
					alert('没有设定奖品，操作失败');
				}
			})
		})

		function queryctrool(id,awardid){
			var url = "{:U('changeinfo')}";
			var setdata = {"id":id,"awardid":awardid,random:Math.random()};
			$.ajax({
				url:url,
				data:setdata,
				type:"POST",
				dataType:"JSON",
				success:function (data){
					if(data.ret==1){
						alert('设置成功，请到“中奖信息”栏查看');
					}else{
						alert('设置失败，请重新查询再次设置');
					}
					location.reload();
				}
			});
		}
	})
</script>
</body>
</html>
